<!-- 顶部蓝色 -->
<template>
	<view class="contaier">
		<view class="top-bg">
			<view class="text-white text-bold text-xxxl">系统名称</view>
			<view class="margin-top-xs text-white">欢迎使用，请先登录</view>
		</view>
		
		<view class="input-box padding-lr">
			<form>
				<view class="cu-form-group margin-top">
					<view class="title">账号</view>
					<input placeholder="账号" v-model="username" type="text"></input>
				</view>
				<view class="cu-form-group">
					<view class="title">密码</view>
					<input placeholder="密码" v-model="password" type="password"></input>
				</view>
			</form>
		</view>
		
		<view class="padding margin-top-xs">
			<button @click="submit" class="cu-btn block round bg-login-zl margin-tb-sm lg">登录</button>
			<!-- <view class="text-gray flex justify-between padding-lr-sm">
				<text>忘记密码</text>
			</view> -->
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: '',
				password: '',
			};
		},
		onLoad() {
			
		},
		methods: {
			submit() {
				if (this.username.length == 0) {
					this.$u.toast('请输入账号');
					return;
				}
				if (this.password.length == 0) {
					this.$u.toast('请输入密码');
					return;
				}		
				this.$store.dispatch("user/Login", {
					username: this.username,
					password: this.password
				}).then(res => {
					uni.switchTab({
					 	url: this.homePage
					});
				});
			},
		}
	};
</script>

<style lang="scss" scoped>
	@import '@/static/scss/system/login/index.scss';
</style>
